package leecode

func findDuplicates(nums []int) (result []int) {
	hashMap := make(map[int]int) //key为数组中的元素 , value为出现的次数
	for i := 0; i < len(nums); i++ {
		hashMap[nums[i]]++
	}
	for key, value := range hashMap {
		if value == 2 {
			result = append(result, key)
		}
	}
	return
}
